<script setup lang="ts">
import { ref } from 'vue'
import { Operation, Platform, List, UserFilled } from '@element-plus/icons-vue'
import HeaderCom from '../../components/Root/HeaderCom.vue'

const isCollapse = ref(false)

const ChangeCollapse = () => {
  isCollapse.value = !isCollapse.value
}

</script>

<template>
  <div class="common-layout">
    <el-container>
      <el-aside class="el-aside" :width="isCollapse ? '64px' : '200px'">
        <el-row class="tac">
          <el-col :span="24">
            <el-menu :collapse="isCollapse" active-text-color="#ffd04b" background-color="rgb(65, 160, 255)"
              class="el-menu-vertical-demo" default-active="2" text-color="#fff" router><!--@select="handleSelect"-->
              <el-menu-item @click="ChangeCollapse()">
                <el-icon>
                  <Operation/>
                </el-icon>
                <template #title>
                  <span>Form Approval</span>
                </template>
              </el-menu-item>
              <!-- 默认会有个首页的入口 -->
              <el-menu-item index='/desktop'>
                <el-icon>
                  <Platform />
                </el-icon>
                <template #title>
                  <span>工作台</span>
                </template>
              </el-menu-item>
              <el-menu-item index='/demand'>
                <el-icon>
                  <List />
                </el-icon>
                <template #title>
                  <span>需求处理</span>
                </template>
              </el-menu-item>
              <!-- <TreeMenu :list="res"></TreeMenu> -->
              <el-menu-item index='/person'>
                <el-icon>
                  <UserFilled />
                </el-icon>
                <template #title>
                  <span>信息编辑</span>
                </template>
              </el-menu-item>
            </el-menu>
          </el-col>
        </el-row>
      </el-aside>
      <el-container>
        <el-header>
          <HeaderCom></HeaderCom>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<style lang="scss" scoped>
.el-aside{
  transition: width 2s ease;
  .el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
}

</style>